package fun.lifepoem.files.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import fun.lifepoem.domain.RestResponse;
import fun.lifepoem.files.service.FilesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Yiwyn
 * @create 2022/7/14 22:50
 */
@RestController
@RequestMapping("/files")
public class FilesController {

    @Autowired
    private FilesService filesService;

    @GetMapping("/hello")
    public String hello() {
        return filesService.hello();
    }

    @PostMapping("/upload")
    public RestResponse<String> upload(MultipartFile file) {
        RestResponse<String> result = filesService.upload(file);
        return result;
    }

}
